package com.brillilab.service.module.message.template.impl.method;

import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

/**
 * @author zlb
 * @Title: RecommendMethodAuditUnPassTemp
 * @ProjectName brill_lab
 * @Description: 成员的推荐方法审核未通过
 * @date 2019/5/27 19:40
 */
@Data
public class RecommendMethodAuditUnPassTemp extends AbstractMessageTemplate {
    private String methodName;
    private String auditContent;

    /**
     * 成员的推荐方法审核未通过
     *
     * @param labId        实验室ID
     * @param receiverId   接收人ID
     * @param labMemberId  接收者实验室成员Id
     * @param methodName   方法名称
     * @param auditContent 审核意见
     */
    public RecommendMethodAuditUnPassTemp(Long labId, Long receiverId, Long labMemberId, String methodName, String auditContent) {
        super(labId, receiverId);
        super.setType(MessageTypeEnum.RecommendMethodAuditUnPass.getValue());
        super.setTitle("您推荐的方法审核未通过");
        String content = String.format("<span>您推荐的方法</span><span style='color:#F6AC2D'>%s</span><span>审核未通过，审核意见为</span>" +
                "<span style='color:#F6AC2D'>%s</span>", methodName, auditContent);
        if (StringUtils.isNotBlank(auditContent)) {
            super.setContent(content);
            super.setAppContent(String.format("您推荐的方法%s审核未通过，审核意见为%s", methodName, auditContent));
        } else {
            content = String.format("<span>您推荐的方法</span><span style='color:#F6AC2D'>%s</span><span>审核未通过</span>", methodName);
            super.setContent(content);
            super.setAppContent(String.format("您推荐的方法%s审核未通过", methodName));
        }
        this.labMemberId = labMemberId;
        this.methodName = methodName;
        this.auditContent = auditContent;
    }

}
